home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / tex-k-archive.gz / tex-k-archive / 000435_martin@enws125.eas.asu.edu_Mon Mar 28 07:27:45 1994.msg < prev    next >
Internet Message Format  |  1994-10-11  |  3KB

  1. Received: from asuvax.eas.asu.edu (asuvax.ASU.EDU) by cs.umb.edu with SMTP id AA15937
  2.   (5.65c/IDA-1.4.4 for <tex-k@cs.umb.edu>); Mon, 28 Mar 1994 16:29:13 -0500
  3. Received: from trcsun3 (enws125.eas.asu.edu) by asuvax.eas.asu.edu with SMTP id AA11570
  4.   (5.65c/IDA-1.4.4 for tex-k@cs.umb.edu); Mon, 28 Mar 1994 14:23:05 -0700
  5. Received: by trcsun3.eas.asu.edu (4.1/SMI-4.1)
  6.     id AA06634; Mon, 28 Mar 94 14:27:45 MST
  7. Date: Mon, 28 Mar 94 14:27:45 MST
  8. From: martin@enws125.eas.asu.edu (Ross Martin)
  9. Message-Id: <9403282127.AA06634@trcsun3.eas.asu.edu>
  10. To: tex-k@cs.umb.edu
  11. Cc: martin@enws125.eas.asu.edu
  12. Subject: xdvik patch to enhance dvips psfile special handling
  13.  
  14.  
  15. Hi,
  16.  
  17. The following patch fixes xdvik 1.7 so that it will handle dvips
  18. psfile specials when the bounding box is not included.  It works by
  19. opening the postscript file and getting the bounding box from it.
  20.  
  21. The motivation for this patch is to get xdvik to work properly with
  22. postscript generated by xfig in the pstex/pstex_t format (which I
  23. highly recommend).
  24.  
  25. cd to the directory containing xdvik-1.7 and do patch -p <this-file.
  26. The only file changed is "xdvik-1.7/xdvik/epsf.c".
  27.  
  28. --Ross Martin
  29. martin@trcsun3.eas.asu.edu
  30.  
  31.  
  32. diff -rc xdvik-1.7/xdvik/epsf.c xdvik-1.7-new/xdvik/epsf.c
  33. *** xdvik-1.7/xdvik/epsf.c    Fri Feb 25 09:34:06 1994
  34. --- xdvik-1.7-new/xdvik/epsf.c    Sat Mar 26 09:05:45 1994
  35. ***************
  36. *** 71,78 ****
  37.     int *llx, *lly, *urx, *ury, *rwi;
  38.   {
  39.     float llx_f, lly_f, urx_f, ury_f, rwi_f;
  40. !   
  41.     special += 6; /* skip the ``psfile'' which may be case-mixed */
  42.     if (sscanf(special, "=%s llx=%f lly=%f urx=%f ury=%f rwi=%f",
  43.                 psfilename, &llx_f, &lly_f, &urx_f, &ury_f, &rwi_f) == 6) {
  44.       *llx = llx_f + .5;
  45. --- 71,84 ----
  46.     int *llx, *lly, *urx, *ury, *rwi;
  47.   {
  48.     float llx_f, lly_f, urx_f, ury_f, rwi_f;
  49. !   FILE *fp;
  50. !   char buffer[500];
  51.     special += 6; /* skip the ``psfile'' which may be case-mixed */
  52. +   if (sscanf(special, "=%s ",psfilename) != 1) {
  53. +     Moan("\"%s\" not understood.", special);
  54. +     return False;
  55. +   }
  56.     if (sscanf(special, "=%s llx=%f lly=%f urx=%f ury=%f rwi=%f",
  57.                 psfilename, &llx_f, &lly_f, &urx_f, &ury_f, &rwi_f) == 6) {
  58.       *llx = llx_f + .5;
  59. ***************
  60. *** 81,87 ****
  61.       *ury = ury_f + .5;
  62.       *rwi = rwi_f + .5;
  63.       return True;
  64. !   } else {
  65.       Moan("\"%s\" not understood.", special);
  66.       return False;
  67.     }
  68. --- 87,113 ----
  69.       *ury = ury_f + .5;
  70.       *rwi = rwi_f + .5;
  71.       return True;
  72. !   } 
  73. !   else {
  74. !     fp=fopen(psfilename,"r");
  75. !     if(!fp)
  76. !       {
  77. !     Moan("File \"%s\" not found!", psfilename);
  78. !     return False;
  79. !       }
  80. !     for(;;)
  81. !       {
  82. !     fscanf(fp,"%[^\n]\n",buffer);
  83. ! /*    printf("Buffer: %s\n",buffer); */
  84. !     if(buffer[0]!='%')
  85. !       break;
  86. !     if(sscanf(buffer,"%%%%BoundingBox: %d %d %d %d", llx, lly, urx, ury)
  87. !        == 4)
  88. !       {
  89. !         *rwi = 10 * (*urx - *llx + 1);
  90. !         return True;
  91. !       }
  92. !       }
  93.       Moan("\"%s\" not understood.", special);
  94.       return False;
  95.     }